package 抽象工厂.DBFactory;

//抽象工厂
public abstract class DBFactory {
    public abstract Connection getConnection();
    public abstract Statement getStatement();
}

//Oracle工厂
class OracleFactory extends  DBFactory{
    public Connection getConnection() {
        return new OracleConnection();
    }
    public Statement getStatement() {
        return new OracleStatement();
    }
}

//MySQL工厂
class MySQLFactory extends  DBFactory{
    public Connection getConnection() {
        return new MySQLConnection();
    }
    public Statement getStatement() {
        return new MySQLStatement();
    }
}